<template>
<view>
<!--hotmall/packageB/testTemplate/testTemplate.wxml-->
<text>hotmall/packageB/testTemplate/testTemplate.wxml</text>
<form report-submit="true" @submit="submit">
  <button formType="submit">1111</button>
</form>
<!-- <form bindsubmit="sub" report-submit="true">
     <button formType="submit">确认发布</button>
</form> -->
</view>
</template>

<script>
// hotmall/packageB/testTemplate/testTemplate.js
import api from "../../../api";
var app = getApp();

export default {
  data() {
    return {};
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    submit(e) {
      console.log(e);
      var a = e.detail.formId;
      wx.getStorage({
        key: 'userId',
        success: function (aaa) {
          console.log(aaa.data);
          var open = aaa.data;
          console.log(open);

          if (a == 'the formId is a mock one') {
            wx.showToast({
              title: '请用手机测试'
            });
          } else {
            app.globalData.request({
              url: api.gzSea.test,
              //仅为示例，并非真实的接口地址
              data: {
                form_id: a,
                user_id: open
              },
              method: 'POST',
              header: {
                'content-type': 'application/x-www-form-urlencoded' // 默认值

              },

              success(res) {
                console.log(res);
              }

            });
          }
        }
      });
    }

  }
};
</script>
<style>
@import "./testTemplate.css";
</style>